package tgc.edu.ljc.entity;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;

import com.fasterxml.jackson.annotation.JsonIgnore;

import tgc.edu.ljc.custom.BaseEntity;

@Entity
public class TbClass extends BaseEntity<Integer>{
	//private Integer id;
	private String name;
	private String manager;
	@JsonIgnore
	private List<Student> students=new ArrayList<>();
	
	@Column(length=20)
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@Column(length=20)
	public String getManager() {
		return manager;
	}
	public void setManager(String manager) {
		this.manager = manager;
	}
	
	@OneToMany(cascade=CascadeType.ALL,mappedBy="tbClass")
	@OrderBy(value="stuNum")
	public List<Student> getStudents() {
		return students;
	}
	public void setStudents(List<Student> students) {
		this.students = students;
	}
	
	
	
}
